import pandas as pd
import numpy as np

data = pd.read_csv('COVID-19 Activity.csv')

columns = ['PEOPLE_POSITIVE_CASES_COUNT', 'COUNTY_NAME', 'PROVINCE_STATE_NAME',
       'REPORT_DATE', 'PEOPLE_DEATH_NEW_COUNT', 'COUNTRY_SHORT_NAME', 
       'PEOPLE_POSITIVE_NEW_CASES_COUNT', 'PEOPLE_DEATH_COUNT']

data = data[columns]

data = data[data.COUNTRY_SHORT_NAME == 'United States']
data = data[data.REPORT_DATE > '2020-02-29']

data['year'], data['month'], data['day'] = data.REPORT_DATE.str.split('-').str

mappingDF = data.groupby('month')['PEOPLE_DEATH_NEW_COUNT'].agg({'sum', 'max', 'min'})

data['number of De'] = data.month.map(mappingDF['sum'])
data['max death'] = data.month.map(mappingDF['max'])
data['min death'] = data.month.map(mappingDF['min'])

data.to_csv('death sumarry at month level_2.csv', index=False)
